﻿@model IEnumerable<bugtracker.Models.UserStat>

@{
    ViewBag.Title = "Global";
}

<script type="text/javascript">
    function ChangeColor(tableRow, highLight) {
        if (highLight) {
            tableRow.style.backgroundColor = '#9ff';
        }
        else {
            tableRow.style.backgroundColor = 'white';
        }
    }

    function DoNav(theUrl) {
        document.location.href = theUrl;
    }
</script>

<h2>Global statistics</h2>

<table>
<tr>
<th>Total amount of users</th>
<td>@ViewBag.TotalUsers</td>
</tr>

<tr>
<th>Total amount of bugs</th>
<td>@ViewBag.TotalBugs</td>
</tr>

<tr>
<th>Total amount of events:</th>
<td>@ViewBag.TotalEvents</td>
</tr>

</table>
<br /><br />

<table>
<tr>
<th>Username</th>
</tr>

@foreach (var item in Model) {
    <tr onmouseover="ChangeColor(this, true);" 
              onmouseout="ChangeColor(this, false);" 
              onclick="loadPartialView('/Stats/Details/?UserName=@item.User.UserName', 'detailview');">
        <td>
            @Html.DisplayFor(modelItem => item.User.UserName)
        </td>
    </tr>
}

</table>
